package com.林子祺.全名健康管理系统.entity.article.content.article;

import com.林子祺.全名健康管理系统.util.ArticleStructure;

import java.util.ArrayList;

public class ArticleData {
    static ArrayList<ArticleStructure> as = new ArrayList<>();

    public static void InputData(String name, String writer, String text, int like){
        as.add(new ArticleStructure(name,writer,text,like));
    }

    public static boolean OutputIndexData(int number){
        if(number < as.size()){
            ArticleStructure p = as.get(number);
            CurrentIndexData.name = p.getName();
            return true;
        }
        else
            return false;
    }

    public static boolean OutputArticleData(int number){
        if(number < as.size()){
            ArticleStructure p = as.get(number);
            CurrentIndexData.name = p.getName();
            CurrentIndexData.writer = p.getWriter();
            CurrentIndexData.text = p.getText();
            CurrentIndexData.like = p.getLike();
            return true;
        }
        else
            return false;
    }

    public static void Refresh(){
        if(as.size() != 0)
            as.removeAll(as);
    }

}
